C (or C++?) Syntax: STRUCTTYPE varname = {0};
Posted
by
Jared Updike
on Stack Overflow
See other posts from Stack Overflow
or by Jared Updike
Published on 2011-02-03T23:23:15Z
Indexed on
2011/02/03
23:25 UTC
Read the original article
Hit count: 168
Normally one would declare/allocate a struct on the stack with?:
STRUCTTYPE varname;
What does this syntax mean in C (or is this C++ only, or perhaps specific to VC++)?
STRUCTTYPE varname = {0};
where STRUCTTYPE is the name of a stuct type, like RECT or something. This code compiles and it seems to just zero out all the bytes of the struct but I'd like to know for sure if anyone has a reference. Also, is there a name for this construct?
© Stack Overflow or respective owner